package mapper;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import bean.Category;
import java.util.List;
import java.util.Map;

public interface CategoryMapper {
    int insertCategory(Category category);
    List<Category> selectByUserId(@Param("userId") Integer userId);
    Category selectById(@Param("id") Integer id);
    int updateCategory(Category category);
    int deleteCategory(Category category);
    int existsByName(@Param("userId") Integer userId,
                     @Param("name") String name,
                     @Param("excludeId") Integer excludeId);
    int countNotesByCategory(@Param("categoryId") Integer categoryId);
    @MapKey("userId")
    List<Map<String, Object>> selectCategoriesWithNoteCount(@Param("userId") Integer userId);
}